const type = (function() {
  const type = Object.create(null);
  const typeArr = [
    'String',
    'Number',
    'Object',
    'Array',
    'Null',
    'Undefined',
    'Boolean'
  ]
  typeArr.forEach(item => {
    type[`is${item}`] = function(args) {
      return Object.prototype.toString.call(args) === `[object ${item}]`
    }
  })
  return type;
})()

console.log(type.isArray([]));
console.log(type.isArray({}));
console.log(type.isArray(12));